using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace needle.Appointments {

    public class Order
    {
        private DateTime _date;
        private Patient _patient;
        private IList _items;

        public DateTime Date
        {
            get { return _date; }
            set { _date = value; }
        }

        public Patient Patient
        {
            get { return _patient; }
            set { _patient = value; }
        }

        public IList Items
        {
            get { return _items; }
            set { _items = value; }
        }

        public Order(Patient patient, Article article, float number)
        {
            _patient = patient;
            _items = new ArrayList();

            Add(article, number);
        }

        public Order Add(Article article, float amount)
        {
            _items.Add(new ItemOrder(article, amount));
            return this;
        }

        public override string ToString()
        {
            string _return = string.Format("> Patient : \t{0}:{1}\n > Date : \t{2}\n > Items : \n", _patient.ID, _patient.Name, _date.ToShortDateString());

            foreach (ItemOrder io in _items)
	        {
                _return += string.Format("\t\t{0}\t{1}\t{2}\n", io.Article.Name, io.Amount, io.Article.Price);
        	}
            return _return;
        }

    }
}
